package com.dingup.paike.service.pk.impl;

import com.dingup.api.Util.DateUtil;
import com.dingup.api.bean.feign.log.LogSearchFeignBean;
import com.dingup.api.model.sys.SysLog;
import com.dingup.paike.feign.client.log.LogFeignClient;
import com.dingup.paike.service.pk.LogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by wancheng on 2018/10/13.
 */
@Service
public class LogServiceImpl implements LogService{

    private static Logger logger = LoggerFactory.getLogger(LogServiceImpl.class);

    @Autowired
    LogFeignClient logFeignClient;

    @Override
    public List<SysLog> getLog(LogSearchFeignBean bean) {
        List<SysLog> logs = logFeignClient.getLog(bean);
        logs.stream().forEach(
                l->{
                    l.setCreateTimeString(DateUtil.date2Str(l.getCreateTime(),"yyyy-MM-dd hh:mm"));
                }
        );
        return logs;
    }
}
